package com.yinian.server.mapper;

import com.yinian.pojo.dto.TeachDetailDTO;
import com.yinian.pojo.entity.App;
import com.yinian.pojo.entity.AppModule;
import com.yinian.pojo.entity.TeachDetail;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface TeachMapper {

    @Select("select * from app")
    List<App> getApp();
@Select("select table_name from app where id = #{id}")
    String getTableNameByAppId(long appId);
    @Select("select table_name from ${moduleTableName} where id = #{moduleId}")
    String getDetailTableNameByModuleId(long moduleId,String moduleTableName);
@Select("select * from ${tableName}")
    List<AppModule> getAppModule(String tableName);
@Select("select * from ${detailTableName} as shop where shop.module_id = #{moduleId}")
TeachDetail getDetailByModuleId(@Param("detailTableName")String detailTableName, @Param("moduleId")long moduleId);
//@Select("select d.*,s.step_name,s.image from ${detailTableName} d left join ${stepTableName} s on s.detail_id = d.id where module_id = #{moduleId}")
    TeachDetailDTO getAllTeachDetail(String detailTableName, String stepTableName, long moduleId);
}
